# @shuaige : 陈世玉
# @name :GuiSpider.py
# @time :2024/12/5 21:46
from selenium import webdriver
import time
path='chromedriver.exe'
browser =webdriver.Chrome(path)
url='https://bingli.iiyi.com/###'
browser.get(url)
#滑到底部
for i in range(20):
    js_bottom="window.scrollTo(0,document.body.scrollHeight)"
    browser.execute_script(js_bottom)
    print(f'爬取第{i+1}页数据')
    news=browser.find_elements_by_xpath('//div[@class="cont_desc"]')
    with open ('data1.txt','w',encoding='utf-8') as f:
        for n in news:
            f.write(n.text+'\n')
    next=browser.find_element_by_link_text('查看更多')
    next.click()
browser.quit()
